<template>
  <div id="myownsongplayer">
      <div class="audio-container">
            <audio id="player"
            controls="controls"
            :src="src"
            @canplay="checkplayMusic"
            >
      </audio>
      </div>

      <el-button @click="playmusic">
          play
      </el-button>
     
  </div>
</template>

<script>
export default {
   name:'MySongPlayer',
   data() {
       return {
           src:'http://localhost:8081/songUrl/1625039024641a.mp3',
           play:false,
       }
   },
   methods: {
       playmusic(){
           this.play=!this.play;
           let player=document.querySelector('#player');
           if(this.play){
            player.play();
            }
            else{
              player.pause();
            }
            console.log(this.play);
       }
   },
}
</script>

<style>

</style>